package com.framework.wz.wutong.base;

import android.app.Application;
import android.support.multidex.MultiDex;
import android.util.Log;

import com.framework.wz.wutong.BuildConfig;
import com.framework.wz.wutong.net.ApiService;
import com.framework.wz.wutong.net.RetrofitHelper;
import com.framework.wz.wutong.utils.DesktopCornerUtil;
import com.tencent.smtt.sdk.QbSdk;

import cn.jpush.android.api.JPushInterface;

public class App extends Application {

    private static Application mApplication;
    private        ApiService  service;

    @Override
    public void onCreate() {
        super.onCreate();

        // 初始化MultiDex
        MultiDex.install(this);
        // init jpush service
        JPushInterface.setDebugMode(BuildConfig.DEBUG);
        JPushInterface.init(this);
        DesktopCornerUtil.init("com.framework.wz.wutong", "com.framework.wz.wutong.ui.activity.LoginActivity", this);
        mApplication = this;
//        if (service == null) {
//            service = new RetrofitHelper().getApiService();
//        }
        initX5WebView();
    }

    public static Application getInstance() {
        return mApplication;
    }

    private void initX5WebView() {
        //搜集本地tbs内核信息并上报服务器，服务器返回结果决定使用哪个内核。

        QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {

            @Override
            public void onViewInitFinished(boolean arg0) {
                // TODO Auto-generated method stub
            }

            @Override
            public void onCoreInitFinished() {
                // TODO Auto-generated method stub
            }
        };
        //x5内核初始化接口
        QbSdk.initX5Environment(getApplicationContext(), cb);
    }
}
